# 列表就是类似js中的数组，是可变的，是有顺序的，可以实现列表的增删改查
nums = [1, 2, "a", True]
nums.append([4, 5])

print(f"nums={nums}")

list_from_string = list("123456")
print(f"通过list函数创建列表={list_from_string}")


# 列表的解包
names = ["jakcie", "linda", "bob", "susan", "smith"]
*manynames, lastname = names
name_one, name_two, *part_name, last_name = names
name1, name2, *otherName = names
print(f"manynames={manynames},lastname={lastname}")
print(
    f"name_one={name_one},name_two={name_two},part_name={part_name},last_name={last_name}"
)
print(f"name={name1},name2={name2},otherName={otherName}")


# 字典的解包
dic = {"name": "jackie", "age": 10, "score": 100, "grade": "A"}

list_name = ["linda", 20, 98.5, "B"]
print(*list_name)


def printPerson(name, age, *args):
    print(f"name1={name},age={age},args={args}")


printPerson(*list_name)
printPerson(*dic)  # *dic 表示解包键值
new_dic = {**dic, "level": 1}
print(f"新的字典={new_dic}")
